package com.talkingdata.hadoop.guard.mapper;

import com.talkingdata.hadoop.guard.bean.ClusterAlias;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

@Mapper

public interface ClusterAliasMapper {
    @Select("select * from cluster_alias " +
            "where hdfs_cluster_id = #{cluster_id} ")
    @Results({
            @Result(property = "hdfsClusterId",column = "hdfs_cluster_id"),
            @Result(property = "yarnClusterId",column = "yarn_cluster_id"),
            @Result(property = "alias",column = "alias"),

    })
    ClusterAlias selectClusterAliasByClusterhdfsId(String cluster_id);

    @Select("select * from cluster_alias " +
            "where yarn_cluster_id = #{cluster_id} ")
    @Results({
            @Result(property = "hdfsClusterId",column = "hdfs_cluster_id"),
            @Result(property = "yarnClusterId",column = "yarn_cluster_id"),
            @Result(property = "alias",column = "alias"),

    })
    ClusterAlias selectClusterAliasByClusteryarnId(String cluster_id);
}
